import SearchBox from '@/components/Search/SearchBox';
import ProCard from '@ant-design/pro-card';
import { Col, Row, Select } from 'antd';
import { useState } from 'react';
import Penetration from './Penetration';
import { KeepAlive } from 'umi';
// import TimeLine from '@/components/TimeLine';
const { Option } = Select;

const EquityNetwork = () => {
  const [date, setDate] = useState();
  const [enterprise, setEnterprise] = useState({
    eid: '',
    name: '',
    status: '',
    network: {
      nodes: [],
      edges: [],
    },
  });

  const getRange = (left, right) => {
    setDate([left, right]);
  };

  const handleTimeChange = (date) => {
    setDate(date);
    console.log('可以可以');
  };

  const handleSubmit = (value) => {
    console.log(value);
    setEnterprise(enterprise.eid === value.eid ? enterprise : value);
    console.log(enterprise);
  };

  return (
    <>
      {/* 顶部的股权网络穿透 - 搜索框 */}
      <ProCard
        title={<b style={{ fontSize: '18px' }}>控制权查询</b>}
        style={{ borderRadius: '8px', marginBottom: '1em', height: '155px' }}
      >
        <Row justify="center">
          <Col>
            请选择演化时间:&nbsp;
            <Select
              style={{
                width: 120,
              }}
              defaultValue="2022"
              onChange={handleTimeChange}
            >
              <Option value="2018">自动演化</Option>
              <Option value="2022">2022</Option>
              <Option value="2021">2021</Option>
              <Option value="2020">2020</Option>
              <Option value="2019">2019</Option>
            </Select>
          </Col>
          &nbsp;
          <Col>
            <KeepAlive>
              <SearchBox
                onSubmit={handleSubmit}
                advices={[
                  {
                    FullName: '招商银行股份有限公司',
                    eid: 'c97ca8d1-ae17-43e4-8bac-b4b22051484c',
                    status: '存续（在营、开业、在册）',
                  },
                ]}
              />
            </KeepAlive>
          </Col>
        </Row>
        {/* 简易时间轴 */}
        {/* <Row justify="center" align="center">
          <TimeLine start="2018-01-01" end="2020-12-31" getRange={getRange}></TimeLine>
        </Row> */}
      </ProCard>
      <KeepAlive>
        <Penetration
          enterprise={enterprise}
          setEnterprise={setEnterprise}
          date={date}
          key={0}
        ></Penetration>
      </KeepAlive>
    </>
  );
};

export default EquityNetwork;
